package Day20;
import java.util.concurrent.CopyOnWriteArrayList;
public class Method {
    public static void main(String[] args) {
        Tools t = new Tools();
        Person p = new Person();
        p.name = "小玉";
        p.age = 20;
        Person p2 = t.copy(p);
        System.out.println("p的姓名是" + p.name + "p的年龄是" + p.age);
        System.out.println("p2的姓名是" + p2.name + "p2的年龄是" + p2.age);
        System.out.println(p == p2);
    }

}
class Person{
    String name;
    int age;
}

class Tools{
    public Person copy(Person p){
        Person p2 = new Person();
        p2.name = p.name;
        p2.age = p.age;
        return p2;
    }
}